#include "shop.h"
#include "map.h"
#include <iostream>
#include <conio.h>
using namespace std;

shop::shop()
/*konstruktor kelas shop*/
{
	vector<int> Accessable_Dest;
	/*array of integer yang berisi kode dalam integer dari map-map yang bisa diakses melalui teleport dari shop*/
	Accessable_Dest.push_back(1);
	for (int j=0;j<6;j++)
	{
		for (int k=0;k<6;k++)
		{
			mshop[j][k]=' ';
		}
	}
}

shop::~shop()
/*destruktor kelas shop*/
{
}

shop::shop(const shop& other)
/*copy konstruktor kelas shop*/
{
	cout<<"Copy Shop"<<endl;
}

vector<int> shop::GetDestination()
/*fungsi getter untuk accesable_dest yang menghasilkan array of integer*/
{
	vector<int> a;
	a.push_back(0);
	return a; 
}

void shop::Display(int xplayer,int yplayer, int player_direction,int xkurcharvest,int ykurcharvest,int kurcharvest_direction, int xkurcwater, int ykurcwater,int kurcwater_direction, int xkurcslash, int ykurcslash,int kurcslash_direction)
/*prosedur untuk menampilkan interface dari shop ke player*/
{
	char playerkiri = (char) 17;
	char playerkanan = (char) 16;
	char playeratas = (char) 30;
	char playerbawah = (char) 31;
	HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
	
	//system("cls");
        gotoxy(0,0);
        //for(int i = 1; i <= 16; i++)
        //    cout<< "               \n";
        gotoxy(0,0);
	cout << endl;
	for(int i=0;i<=7;i++) {
		SetConsoleTextAttribute (hOut, BGI);
		cout << "_";
		SetConsoleTextAttribute (hOut, FW);
	}
	cout << endl;
	for (int i=0;i<6;i++)
	{
		SetConsoleTextAttribute (hOut, BGI);
		cout << "|";
		SetConsoleTextAttribute (hOut, FW);
		for (int j=0;j<6;j++)
		{
			SetConsoleTextAttribute (hOut, BYI);
			if(xplayer==j && yplayer==i && player_direction==0) {
				SetConsoleTextAttribute (hOut, FRI);
				cout << playerkiri;
				SetConsoleTextAttribute (hOut, FW);
			}else if(xplayer==j && yplayer==i && player_direction==1){
				SetConsoleTextAttribute (hOut, FRI);
				cout << playerkanan;
				SetConsoleTextAttribute (hOut, FW);
			}else if(xplayer==j && yplayer==i && player_direction==2){
				SetConsoleTextAttribute (hOut, FRI);
				cout << playeratas;
				SetConsoleTextAttribute (hOut, FW);
			}else if(xplayer==j && yplayer==i && player_direction==3){
				SetConsoleTextAttribute (hOut, FRI);
				cout << playerbawah;
				SetConsoleTextAttribute (hOut, FW);
			}else{
				cout<<mshop[i][j];
			}
			SetConsoleTextAttribute (hOut, FW);
		}
		SetConsoleTextAttribute (hOut, BGI);
		cout << "|";
		SetConsoleTextAttribute (hOut, FW);
		if (i==0){
			SetConsoleTextAttribute (hOut, FG);
			cout << "             _" ;
			SetConsoleTextAttribute (hOut, FW);
		}else if(i==1){
			SetConsoleTextAttribute (hOut, FG);
			cout << "         .--| |--.  " ;
			SetConsoleTextAttribute (hOut, FW);
		}else if(i==2){
			SetConsoleTextAttribute (hOut, FYI);
			cout << "\\(`.`\\)";
			SetConsoleTextAttribute (hOut, FG);
			cout << " | (_| |_\\_| " ;
			SetConsoleTextAttribute (hOut, FW);
		}else if(i==3){
			SetConsoleTextAttribute (hOut, FP);
			cout << "WELCOME";
			SetConsoleTextAttribute (hOut, FG);
			cout << " '_._| |_'.  " ;
			SetConsoleTextAttribute (hOut, FW);
		}else if(i==4){
			SetConsoleTextAttribute (hOut, FG);
			cout << "        | \\_| |_) | " ;
			SetConsoleTextAttribute (hOut, FW);
		}else if(i==5){
			SetConsoleTextAttribute (hOut, FG);
			cout << "         '--|_|--'  " ;
			SetConsoleTextAttribute (hOut, FW);
		}
		cout << endl;
	}
	for(int i=0;i<=7;i++) {
		SetConsoleTextAttribute (hOut, BGI);
		cout << "_";
		SetConsoleTextAttribute (hOut, FW);
	}
	cout << endl;
	cout << endl;
        gotoxy(0,17); cout<< "\t\t\t\t\t\t\t\t";
        gotoxy(0,17); cout<< ">";
}
